<?php



class InvoiceMapBuilder implements MapBuilder {

	
	const CLASS_NAME = 'lib.model.map.InvoiceMapBuilder';

	
	private $dbMap;

	
	public function isBuilt()
	{
		return ($this->dbMap !== null);
	}

	
	public function getDatabaseMap()
	{
		return $this->dbMap;
	}

	
	public function doBuild()
	{
		$this->dbMap = Propel::getDatabaseMap(InvoicePeer::DATABASE_NAME);

		$tMap = $this->dbMap->addTable(InvoicePeer::TABLE_NAME);
		$tMap->setPhpName('Invoice');
		$tMap->setClassname('Invoice');

		$tMap->setUseIdGenerator(false);

		$tMap->addForeignPrimaryKey('INVOICE_IDEN', 'InvoiceIden', 'VARCHAR' , 'document', 'DOCUMENT_IDEN', true, 20);

		$tMap->addForeignKey('CUSTOMER_IDEN', 'CustomerIden', 'VARCHAR', 'contact', 'IDEN', true, 20);

		$tMap->addForeignKey('INVOICE_TYPE', 'InvoiceType', 'VARCHAR', 'list_document_types', 'TYPEID', true, 5);

		$tMap->addColumn('INVOICE_ID', 'InvoiceId', 'VARCHAR', true, 15);

		$tMap->addForeignKey('TERMS_NAME', 'TermsName', 'VARCHAR', 'list_invoice_terms', 'TERM', true, 20);

		$tMap->addColumn('DAYS_DUE', 'DaysDue', 'INTEGER', true, 10);

		$tMap->addForeignKey('OWNER_IDEN', 'OwnerIden', 'VARCHAR', 'account_owner', 'CONTACT_IDEN', true, 18);

		$tMap->addColumn('REMARKS', 'Remarks', 'LONGVARCHAR', true, null);

		$tMap->addColumn('DELIVERY_DETAILS', 'DeliveryDetails', 'LONGVARCHAR', false, null);

		$tMap->addColumn('INVOICE_NAME', 'InvoiceName', 'VARCHAR', true, 200);

		$tMap->addColumn('DELIVERY_MODE', 'DeliveryMode', 'VARCHAR', true, 10);

		$tMap->addColumn('COUNTER_CODE', 'CounterCode', 'VARCHAR', true, 10);

		$tMap->addColumn('DELIVERY_DATE', 'DeliveryDate', 'DATE', true, null);

		$tMap->addColumn('VAT_EXCEMPT_TYPE', 'VatExcemptType', 'VARCHAR', true, 20);

	} 
} 